<!DOCTYPE html>
<!--suppress ALL-->
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('编辑')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-action-edit" th:object="${data}">
        <input type="hidden" id="id" name="id" th:field="*{id}"/>
        <div class="form-group">
            <label class="col-sm-3 control-label">主键id：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" id="id" name="id" placeholder="请输入主键id" th:field="*{id}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">数据库IP：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" id="mysqlIp" name="mysqlIp" placeholder="请输入数据库IP"
                       th:field="*{mysqlIp}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">数据库端口：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" id="mysqlPort" name="mysqlPort" placeholder="请输入数据库端口"
                       th:field="*{mysqlPort}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备份命令：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" id="mysqlCmd" name="mysqlCmd" placeholder="请输入备份命令"
                       th:field="*{mysqlCmd}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">恢复命令：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" id="mysqlBackCmd" name="mysqlBackCmd" placeholder="请输入恢复命令"
                       th:field="*{mysqlBackCmd}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">数据库名称：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" id="databaseName" name="databaseName" placeholder="请输入数据库名称"
                       th:field="*{databaseName}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备份数据地址：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" id="backupsPath" name="backupsPath" placeholder="请输入备份数据地址"
                       th:field="*{backupsPath}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备份文件名称：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" id="backupsName" name="backupsName" placeholder="请输入备份文件名称"
                       th:field="*{backupsName}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">操作次数：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" id="operation" name="operation" placeholder="请输入操作次数"
                       th:field="*{operation}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">数据状态（1正常，-1删除）：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" id="status" name="status" placeholder="请输入数据状态（1正常，-1删除）"
                       th:field="*{status}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">恢复时间：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" id="recoveryTime" name="recoveryTime" placeholder="请输入恢复时间"
                       th:field="*{recoveryTime}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备份时间：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" id="createTime" name="createTime" placeholder="请输入备份时间"
                       th:field="*{createTime}">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<script type="text/javascript">
    var prefix = ctx + "ajax/mysqlbackups";
    let id = [[${data.id}]];
    let ajaxUrl = prefix + "/edit";
    if (id == 0) {
        ajaxUrl = prefix + "/add";
    }

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(ajaxUrl, $('#form-action-edit').serialize());
        }
    }
</script>
</body>
</html>
